//
//  RootTabBarController.m
//  B_Project
//
//  Created by 宋强 on 16/3/30.
//  Copyright © 2016年 宋强. All rights reserved.
//

#import "RootTabBarController.h"

@interface RootTabBarController ()

@end

@implementation RootTabBarController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.viewControllers = [self creatViews];
        self.tabBar.tintColor = [UIColor blackColor];
    }
    return self;
}
- (NSArray <UIViewController *> *)creatViews
{
    //初始化数组
    NSMutableArray *arr = [NSMutableArray array];
    //跑步模块
    RunViewController *runVC = [[RunViewController alloc] init];
    UINavigationController *runNavi = [[UINavigationController alloc] initWithRootViewController:runVC];
    runNavi.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"跑步" image:[UIImage imageNamed:@"paobu"] tag:1000];
    [arr addObject:runNavi];
    //训练模块
    FitnessViewController *fitVC = [[FitnessViewController alloc] init];
    UINavigationController *fitNavi = [[UINavigationController alloc] initWithRootViewController:fitVC];
    fitNavi.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"训练" image:[UIImage imageNamed:@"xunlian"] tag:2000];
    [arr addObject:fitNavi];
    //音乐模块
    
    MusicViewController *musicVC = [[MusicViewController alloc] init];
    UINavigationController *musicNavi = [[UINavigationController alloc] initWithRootViewController:musicVC];
    musicNavi.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"音乐" image:[UIImage imageNamed:@"yinyue"] tag:3000];
    [arr addObject:musicNavi];
    
    //我的模块
    
    MineViewController *mineVC = [[MineViewController alloc] init];
    UINavigationController *mineNavi = [[UINavigationController alloc] initWithRootViewController:mineVC];
    mineNavi.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"wo"] tag:4000];
    [arr addObject:mineNavi];
    
    
    
    
    return arr;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
